import React, { useEffect, useState } from 'react';
import { Button, Timeline } from 'antd';
import { getList } from '@/apis/api';
function Bot() {
    const [reverse, setReverse] = useState(false);
    const [data,setData]=useState('')
    const aa=async()=>{
            const res=await getList({
                page:1,//页码  必传
    pageSize:6,//每页显示条数 必传
    keyword:null,//搜索标题
    tag:null//搜索标签
    
            })
            console.log(res);
            setData(res.data.rows)
        }
        useEffect(()=>{
            aa()
        },[])
  const handleClick = () => {
    setReverse(!reverse);
  };

    return (
        <div>
            <Timeline
            style={{marginLeft:'200px'}}
        
        mode='left'
        reverse={reverse}
        items={data&&data.map((v,i)=>{
            return {
                children: v.createdAt+v.title,
                
            }
        })}
        
        // items={[
        //   {
        //     children: 'Create a services site 2015-09-01',
        //   },
        //   {
        //     children: 'Solve initial network problems 2015-09-01',
        //   },
        //   {
        //     children: 'Technical testing 2015-09-01',
        //   },
        // ]}
      />
      <Button type="primary" style={{ marginTop: 16 }} onClick={handleClick}>
        {reverse?'正序':'倒序'}
      </Button>
        </div>
    );
}

export default Bot;